home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / cdity / ModeProSrc.lha / Prefs / MPPPListLV.c < prev    next >
C/C++ Source or Header  |  2000-09-17  |  4KB  |  147 lines

  1. #include "mpp.h"
  2. #include <graphics/rpattr.h>
  3. #include <extras/ext_text.h>
  4.  
  5. LONG FillShinePen,FillShadowPen;
  6.  
  7. ULONG __saveds __asm PromotionLVFunc(register __a0 struct Hook *Hook,
  8.                                 register __a1 struct LVDrawMsg *Dm,
  9.                                 register __a2 struct DefaultNode *DN)
  10.   struct RastPort *rp;
  11.   LONG top,bottom,left,right,baseline;
  12.   LONG fgpen,bgpen;
  13.   ULONG state,selected;
  14.   
  15.   if(Dm->lvdm_MethodID!=LV_DRAW)
  16.     return(LVCB_UNKNOWN);
  17.  
  18.   left  =Dm->lvdm_Bounds.MinX;
  19.   top   =Dm->lvdm_Bounds.MinY;
  20.   right =Dm->lvdm_Bounds.MaxX;
  21.   bottom=Dm->lvdm_Bounds.MaxY;
  22.  
  23.   rp=Dm->lvdm_RastPort;
  24.   
  25.   state=Dm->lvdm_State;
  26.  
  27.   if(LVR_SELECTED == state || LVR_SELECTEDDISABLED == state)
  28.   {
  29.     fgpen=Dm->lvdm_DrawInfo->dri_Pens[FILLTEXTPEN];
  30.     bgpen=Dm->lvdm_DrawInfo->dri_Pens[FILLPEN];
  31.     selected=1;
  32.   }
  33.   else
  34.   {
  35.     fgpen=Dm->lvdm_DrawInfo->dri_Pens[TEXTPEN];
  36.     bgpen=Dm->lvdm_DrawInfo->dri_Pens[BACKGROUNDPEN];
  37.     selected=0;
  38.   }
  39.  
  40.   SetAPen(rp,bgpen);
  41.  
  42.   RectFill(rp,left,top,right,bottom);
  43.  
  44.   baseline=rp->Font->tf_Baseline+top;
  45.  
  46.   if((DN->Flags & DNF_NEVER_PROMOTE))
  47.   {
  48.     LONG shine,shadow;
  49.     
  50.     if(selected && FillShinePen!=-1 && FillShadowPen!=-1)
  51.     {
  52.       shine=FillShinePen;
  53.       shadow=FillShadowPen;
  54.     }
  55.     else
  56.     {
  57.       shine=Dm->lvdm_DrawInfo->dri_Pens[SHINEPEN];
  58.       shadow=Dm->lvdm_DrawInfo->dri_Pens[SHADOWPEN];
  59.     }
  60.  
  61.       
  62.     SetRPAttrs(rp,
  63. //        RPTAG_APen   ,Dm->lvdm_DrawInfo->dri_Pens[SHINEPEN],
  64.       RPTAG_APen   ,shine,
  65.       RPTAG_DrMd   ,JAM1,
  66.       TAG_DONE);
  67.  
  68.     gui_RenderText(rp, DN->Def_Node.ln_Name,
  69.                RT_XPos          ,left+2,
  70.                RT_Baseline      ,baseline+1,
  71.                RT_MaxWidth      ,right-left-4,
  72.                TAG_DONE); 
  73.     
  74.     SetRPAttrs(rp,
  75. //        RPTAG_APen   ,Dm->lvdm_DrawInfo->dri_Pens[SHADOWPEN],
  76.       RPTAG_APen   ,shadow,
  77.       TAG_DONE);
  78.     
  79.     gui_RenderText(rp, DN->Def_Node.ln_Name,
  80.                RT_XPos          ,left+1,
  81.                RT_Baseline      ,baseline,
  82.                RT_MaxWidth      ,right-left-4,
  83.                TAG_DONE); 
  84.   }
  85.   else
  86.   {
  87.     if(DN->Flags & DNF_UNAPPROVED)
  88.     {
  89.       SetRPAttrs(rp,
  90.              RPTAG_APen   ,fgpen,
  91.              RPTAG_DrMd   ,JAM1,
  92.              TAG_DONE);
  93.   
  94.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  95.              RT_XPos          ,left+1,
  96.              RT_Baseline      ,baseline,
  97.              RT_MaxWidth      ,right-left-4,
  98.              TAG_DONE); 
  99.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  100.              RT_XPos          ,left+3,
  101.              RT_Baseline      ,baseline,
  102.              RT_MaxWidth      ,right-left-4,
  103.              TAG_DONE); 
  104.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  105.              RT_XPos          ,left+2,
  106.              RT_Baseline      ,baseline-1,
  107.              RT_MaxWidth      ,right-left-4,
  108.              TAG_DONE); 
  109.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  110.              RT_XPos          ,left+2,
  111.              RT_Baseline      ,baseline+1,
  112.              RT_MaxWidth      ,right-left-4,
  113.              TAG_DONE); 
  114.              
  115.       SetRPAttrs(rp,
  116.              RPTAG_APen   ,bgpen,
  117.              RPTAG_DrMd   ,JAM1,
  118.              TAG_DONE);
  119.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  120.              RT_XPos          ,left+2,
  121.              RT_Baseline      ,baseline,
  122.              RT_MaxWidth      ,right-left-4,
  123.              TAG_DONE); 
  124.     }
  125.     else // Render normally
  126.     {
  127.       SetRPAttrs(rp,
  128.                RPTAG_APen   ,fgpen,
  129.                RPTAG_DrMd   ,JAM1,
  130.                TAG_DONE);
  131.   
  132.       gui_RenderText(rp, DN->Def_Node.ln_Name,
  133.                  RT_XPos          ,left+1,
  134.                  RT_Baseline      ,baseline,
  135.                  RT_MaxWidth      ,right-left-2,
  136.                  TAG_DONE); 
  137.     }
  138.   }  
  139.   
  140.   if(LVR_NORMALDISABLED == state || LVR_SELECTEDDISABLED == state )
  141.     gui_GhostRect(rp,Dm->lvdm_DrawInfo->dri_Pens[TEXTPEN],left,top,right,bottom);
  142.   
  143.   return(LVCB_OK);
  144. }
  145.  
  146.